//接口层

//引入request.js
import request from'@/utils/request.js';

//以下为用户模块所有接口

//登陆
export const Login=(data)=>{
    return request({
        url:'/users/checkLogin',
        method:'post',
        data
    })
}

// 账号重复
export const accRepeat=(data)=>{
    return request({
        url:'/users/repeat',
        method:'post',
        data
    })
}



// 添加账号
export const accRepeatAdd=(data)=>{
    return request({
        url:'/users/add',
        method:'post',
        data
    })
}


// 账号列表
export const reqAccList=(params)=>{
    return request({
        url:'/users/list',
        method:'get',
       params
    })
}

// 账号删除
export const accountDel=(params)=>{
    return request({
        url:'/users/del',
        method:'get',
        params
    })
}


// 批量删除
export const accounBatchAdd=(data)=>{
    return request({
        url:'/users/batchdel',
        method:'post',
        data
    })
}

// 修改账号
export const getAddEdit=(data)=>{
    return request({
        url:'/users/edit',
        method:'post',
        data
    })
}

// 检查旧密码是否正确
export const checkoldpwd=(params)=>{
    return request({
        url:'/users/checkoldpwd',
        method:'get',
        params
    })
}

// 修改密码
export const pwdEdit=(data)=>{
    return request({
        url:'/users/editpwd',
        method:'post',
        data
    })
}


// 获取用户信息
export const getUserInfo=(data)=>{
    return request({
        url:'/users/info',
        method:'get',
        data
    })
}

//修改用户头像
export const reqUploadAvatar=(params)=>{
    return request({
        url:'/users/avataredit',
        method:'get',
        params
    })
}


//获取分类列表
export const getGoodsList=(params)=>{
    return request({
        url:'/goods/catelist',
        method:'get',
        params
    })
}


//添加分类
export const addGoodsCate=(data)=>{
    return request({
        url:'/goods/addcate',
        method:'post',
        data
    })
}


//修改分类
export const editGoodsCate=(data)=>{
    return request({
        url:'/goods/editcate',
        method:'post',
        data
    })
}


//删除分类
export const delGoodsCate=(params)=>{
    return request({
        url:'/goods/delcate',
        method:'get',
        params
    })
}


//查询所有启用的分类名称
export const queryGoodsCate=(params)=>{
    return request({
        url:'/goods/categories',
        method:'get',
        params
    })
}


//添加商品
export const addGoods=(data)=>{
    return request({
        url:'/goods/add',
        method:'post',
        data
    })
}

//获取商品列表数据
export const getGoods=(params)=>{
    return request({
        url:'/goods/list',
        method:'get',
        params
    })
}